package com.ruoyi.zyx.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zyx.mapper.ZyxAllotMapper;
import com.ruoyi.zyx.domain.ZyxAllot;
import com.ruoyi.zyx.service.IZyxAllotService;

/**
 * 调拨信息Service业务层处理
 *
 * @author lhs
 * @date 2021-06-07
 */
@Service
public class ZyxAllotServiceImpl implements IZyxAllotService
{
    @Autowired
    private ZyxAllotMapper zyxAllotMapper;

    /**
     * 查询调拨信息
     *
     * @param id 调拨信息ID
     * @return 调拨信息
     */
    @Override
    public ZyxAllot selectZyxAllotById(Long id)
    {
        return zyxAllotMapper.selectZyxAllotById(id);
    }

    @Override
    public ZyxAllot getByDeviceId(Long deviceid) {
        return zyxAllotMapper.getByDeviceId(deviceid);
    }

    /**
     * 查询调拨信息列表
     *
     * @param zyxAllot 调拨信息
     * @return 调拨信息
     */
    @Override
    public List<ZyxAllot> selectZyxAllotList(ZyxAllot zyxAllot)
    {
        return zyxAllotMapper.selectZyxAllotList(zyxAllot);
    }

    /**
     * 新增调拨信息
     *
     * @param zyxAllot 调拨信息
     * @return 结果
     */
    @Override
    public int insertZyxAllot(ZyxAllot zyxAllot)
    {
        zyxAllot.setCreateTime(DateUtils.getNowDate());
        return zyxAllotMapper.insertZyxAllot(zyxAllot);
    }

    @Override
    public int delByDeviceId(Long deviceid) {
        return zyxAllotMapper.delByDeviceId(deviceid);
    }

    /**
     * 修改调拨信息
     *
     * @param zyxAllot 调拨信息
     * @return 结果
     */
    @Override
    public int updateZyxAllot(ZyxAllot zyxAllot)
    {
        zyxAllot.setUpdateTime(DateUtils.getNowDate());
        return zyxAllotMapper.updateZyxAllot(zyxAllot);
    }

    /**
     * 批量删除调拨信息
     *
     * @param ids 需要删除的调拨信息ID
     * @return 结果
     */
    @Override
    public int deleteZyxAllotByIds(Long[] ids)
    {
        return zyxAllotMapper.deleteZyxAllotByIds(ids);
    }

    /**
     * 删除调拨信息信息
     *
     * @param id 调拨信息ID
     * @return 结果
     */
    @Override
    public int deleteZyxAllotById(Long id)
    {
        return zyxAllotMapper.deleteZyxAllotById(id);
    }
}
